//
//  ViewController.m
//  Version1.0_RectiveCocoa
//
//  Created by 吴可高 on 2018/1/10.
//  Copyright © 2018年 吴可高. All rights reserved.
//

#import "ViewController.h"
#import "Masonry.h"
#import "VCOptionModel.h"
#import <ReactiveObjC/ReactiveObjC.h>
#import "PresentViewController.h"

#define iphoneWidth  [UIScreen mainScreen].bounds.size.width
#define iphoneHeight [UIScreen mainScreen].bounds.size.height

@interface ViewController ()
@property(nonatomic,strong) UITextField * item_TextField;
@property(nonatomic,strong) UITextField * item_TextField1;
@property(nonatomic,strong) UIButton * item;

@property(nonatomic,strong) VCOptionModel * VCModel;
@property(nonatomic,strong) PresentViewController * VC;

@end

@implementation ViewController
#pragma mark - getter method
-(UIButton *)item
{
    _item =({
        if (!_item) {
            _item = [UIButton buttonWithType:UIButtonTypeCustom];
            [_item setTitle:@"presentVC" forState:UIControlStateNormal];
            [_item addTarget:self action:@selector(presentVC) forControlEvents:UIControlEventTouchUpInside];
            _item.backgroundColor = [UIColor blueColor];
        }
        _item;
    });
    return _item;
}

-(PresentViewController *)VC{
    _VC = [[PresentViewController alloc]init];
    return _VC;
}

-(UITextField *)item_TextField{
    _item_TextField = ({
        if (!_item_TextField) {
            _item_TextField = [[UITextField alloc]init];
            _item_TextField.placeholder = @"insert_datatext";
            _item_TextField.layer.masksToBounds = YES;
            _item_TextField.layer.cornerRadius = 5.f;
            _item_TextField.layer.borderWidth = 1.f;
            _item_TextField.layer.borderColor = [UIColor brownColor].CGColor;
        }
        _item_TextField;
    });
    return _item_TextField;
}


-(UITextField *)item_TextField1{
    _item_TextField1 = ({
        if (!_item_TextField1) {
            _item_TextField1 = [[UITextField alloc]init];
            _item_TextField1.placeholder = @"insert_datatext";
            _item_TextField1.layer.masksToBounds = YES;
            _item_TextField1.layer.cornerRadius = 5.f;
            _item_TextField1.layer.borderWidth = 1.f;
            _item_TextField1.layer.borderColor = [UIColor brownColor].CGColor;
        }
        _item_TextField1;
    });
    return _item_TextField1;
}
-(void)presentVC
{
    [self presentViewController:self.VC animated:YES completion:nil];
}
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    [super touchesBegan:touches withEvent:event];
    [self.view endEditing:YES];
}
-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:YES animated:YES];
}
-(void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    [self.navigationController setNavigationBarHidden:NO animated:YES];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.view addSubview:self.item_TextField];
    [self.view addSubview:self.item_TextField1];
    [self.view addSubview:self.item];
//    [[VCOptionModel shareInstance]loginConditionContainer:self.item_TextField];
    [[VCOptionModel shareInstance]senderConcatSessionWithContainer:self.item_TextField container:self.item_TextField1];
//    [[VCOptionModel shareInstance]senderFilterWithContriner:self.item_TextField];
//    [[VCOptionModel shareInstance]senderSequenceWithContainer:self.item_TextField];
}

-(void)viewDidLayoutSubviews{
    [super viewDidLayoutSubviews];
    __weak typeof(self)weakSelf = self;
    [self.item_TextField mas_makeConstraints:^(MASConstraintMaker *make)
     {
         make.size.mas_equalTo(CGSizeMake(iphoneWidth/2.3, 35.f));
         make.left.mas_equalTo(weakSelf.view.mas_left).with.offset(40.f);
         make.top.mas_equalTo(weakSelf.view.mas_top).with.offset(40.f);
     }];
    [self.item_TextField1 mas_makeConstraints:^(MASConstraintMaker *make)
     {
         make.size.mas_equalTo(CGSizeMake(iphoneWidth/2.3, 35.f));
         make.left.mas_equalTo(weakSelf.view.mas_left).with.offset(40.f);
         make.top.mas_equalTo(weakSelf.item_TextField.mas_bottom).with.offset(40.f);
     }];
    [self.item mas_makeConstraints:^(MASConstraintMaker *make) {
         make.size.mas_equalTo(CGSizeMake(iphoneWidth/2.3, 35.f));
         make.top.mas_equalTo(weakSelf.item_TextField1.mas_bottom).with.offset(50.f);
         make.centerX.mas_equalTo(weakSelf.view.mas_centerX).with.offset(0.f);
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

@end

